#include<iostream>
#include <cmath>
using namespace std;

int main(){
    int n_tree=0;
    int n_action=0;

    cin>>n_tree>>n_action;
    n_action=n_action+1;//save the original number
    int **array;
    array = (int **)malloc(n_tree* sizeof(int *));
    for (int i = 0; i < n_tree; ++i) {
        array[i]=(int *)malloc(n_action* sizeof(int));
    }

    for (int k = 0; k < n_tree; ++k) {
        for (int i = 0; i < n_action; ++i) {
            cin>>array[k][i];
        }
    }

    for (int m = 0; m < n_tree; ++m) {
        for (int i = 1; i < n_action; ++i) {
            array[m][0] =array[m][0] + array[m][i];
        }
    }
    int res_sum = 0;
    for (int l = 0; l < n_tree; ++l) {
        res_sum = res_sum+array[l][0];
    }

    int max_index = 0;
    int max_number=0;
    for (int n = 0; n < n_tree; ++n) {
        for (int i = 2; i < n_action; ++i) {
            array[n][1] = array[n][1]+array[n][i];
        }
        array[n][1]=-array[n][1];
    }
    for (int i1 = 0; i1 < n_tree; ++i1) {
        if (array[i1][1]>max_number){
            max_number=array[i1][1];
            max_index=i1;
        }
        else{
            continue;
        }
    }
    max_index = max_index+1;
    cout<<res_sum<<" "<<max_index<<" "<<max_number;
    for (int j = 0; j < n_tree; ++j) {
        free(array[j]);
    }
    free(array);
}
